using System;
using Nakio.Framework.Interfaces;

namespace Nakio.Framework.Client
{
    public class ClientCallback : IServerContractCallback
    {
        public Communication.EncryptToken EncryptToken { get; set; }
        private Guid _guid;


        public Guid Guid()
        {
            if (_guid == null)
            {
                _guid = new Guid();
            }
            return _guid;
        }

        public object ExecuteClientReturnCommand(Communication.EncryptedCommand encryptedCommand)
        {
            var command = encryptedCommand.DecryptCommand(EncryptToken, null);
            return command.Execute();
        }
    }
}